using System;

namespace ICommonLibrary.Date {

    // A simple and light weight stop watch. It is suitable for measuring a short process.
    public class SimpleStopWatch {

        public static SimpleStopWatch Start() {
            return new SimpleStopWatch();
        }

        private int _start;

        private SimpleStopWatch() {
            Reset();
        }

        public void Reset() {
            _start = Environment.TickCount & Int32.MaxValue; // millisecs
        }

        public int ElapsedMilliseconds() {
            int end = Environment.TickCount & Int32.MaxValue;
            return end - _start;
        }

    }
}